package io.github.talelin.latticy.controller.v1.K;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.github.talelin.latticy.model.K.ChartCollectionDO;
import io.github.talelin.latticy.service.K.ChartCollectionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.PathVariable;
import io.github.talelin.latticy.vo.CreatedVO;
import io.github.talelin.latticy.vo.DeletedVO;
import io.github.talelin.latticy.vo.UpdatedVO;

import javax.validation.constraints.Positive;

import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * VIEW前端控制器
 *
* @author generator@TaleLin
* @since 2021-07-05
*/
@RestController
@RequestMapping("/v1/chartCollection")
public class ChartCollectionController {

    @Autowired
    private ChartCollectionService ChartCollectionService;
    
    @PostMapping("")
    public CreatedVO create() {
        return new CreatedVO();
    }

    @PutMapping("/{id}")
    public UpdatedVO update(@PathVariable @Positive(message = "{id.positive}") Integer id) {
        return new UpdatedVO();
    }

    @DeleteMapping("/{id}")
    public DeletedVO delete(@PathVariable @Positive(message = "{id.positive}") Integer id) {
        return new DeletedVO();
    }

    @GetMapping("/{id}")
    public ChartCollectionDO get(@PathVariable(value = "id") @Positive(message = "{id.positive}") Integer id) {
        return null;
    }

    @GetMapping("/page")
    public List<ChartCollectionDO> page() {
        QueryWrapper<ChartCollectionDO> wrapper = new QueryWrapper<>();
        List<ChartCollectionDO> paging = ChartCollectionService.getBaseMapper().selectList(null);
        return paging;
    }

}
